using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameOverUI : MonoBehaviour
{
    [SerializeField] private GameObject fallPig;
    [SerializeField] private StartUI startUI1;
    [SerializeField] private StartUI startUI2;
    [SerializeField] private StartUI startUI3;
    
    
    private Animator anim;

    private int starCount = 0;

    private void Awake()
    {
        anim = GetComponent<Animator>();
        
    }

    public void Show(int starCount)
    {
        anim.SetTrigger("IsShow");
        this.starCount = starCount;
    }

    public void ShowStar()
    {
        if (starCount == 0)
        {
            fallPig.SetActive(true);
        }

        if (starCount >= 1)
        {
            startUI1.Show();
        }
        if (starCount >= 2)
        {
            startUI2.Show();
        }
        if (starCount >= 3)
        {
            startUI3.Show();
        }
    }

    public void OnRestartButtonClick()
    {
        GameManager.Instance.OnRestartLevel();
    }

    public void OnLevelListButtonClick()
    {
        GameManager.Instance.LevelList();
    }
}
